using System;
using DG.Tweening;
using UnityEngine;
using Voodoo.GameOps;
using Voodoo.Pattern;

public class Oil3DVisual : MonoBehaviour
{
	public Transform Visuals;

	public Vector3 MinSize;

	public Vector3 MaxSize;

	public Item upgradeItem;

	private void Start()
	{
		Visuals.parent.gameObject.SetActive(Preloader.ShopConfig.UpgradeShop);
		MessageCenter instance = SingletonMB<MessageCenter>.Instance;
		instance.OnPermanentUpgrade = (Action)Delegate.Combine(instance.OnPermanentUpgrade, new Action(Upgrade));
		Visuals.transform.localScale = Vector3.Lerp(MinSize, MaxSize, (float)InventoryManager.Instance.GetInventoryCount(upgradeItem) / (float)upgradeItem.Max);
	}

	public void Upgrade()
	{
		Visuals.DOScale(Vector3.Lerp(MinSize, MaxSize, (float)InventoryManager.Instance.GetInventoryCount(upgradeItem) / (float)upgradeItem.Max), 0.5f);
	}
}
